﻿using System;
using NUnit.Framework;

namespace Alabra.ExtensionMethods.ExtensionMethodsTest
{
    public class DateTimeExtensionLastDayOfMonthTest
    {
        [Test]
        public void WhenDateTimeIsFirtsDayOfMonthReturnLastDayOfMonth()
        {
            var lastDayJanuary = new DateTime(2010, 01, 31);

            Assert.AreEqual(lastDayJanuary, lastDayJanuary.LastDayOfMonth());
        }
        [Test]
        public void WhenDateTimeIsOtherDayOfMonthReturnLastDayOfMonth()
        {
            var lastDayJanuary = new DateTime(2010, 01, 31);
            var otherDayJanuary = new DateTime(2010, 01, 20);

            Assert.AreEqual(lastDayJanuary, otherDayJanuary.LastDayOfMonth());
        }
        [Test]
        public void WhenDateTimeIsEndDayOfMonthReturnLastDayOfMonth()
        {
            var lastDayJanuary = new DateTime(2010, 01, 31);

            Assert.AreEqual(lastDayJanuary, lastDayJanuary.LastDayOfMonth());
        }
        [Test]
        public void WhenDateTimeIsFebruaryLeapYearReturn29DayOfMonth()
        {
            var lastDayFebruaryLeapYear = new DateTime(2000, 02, 29);

            Assert.AreEqual(lastDayFebruaryLeapYear, lastDayFebruaryLeapYear.LastDayOfMonth());
        }
    }
}
